package com.yh.correct.service.impl;

import java.util.List;
import java.util.Map;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yh.correct.dao.IInterviewPersonnelMapper;
import com.yh.correct.model.InterviewPersonnel;
import com.yh.correct.model.Page;
import com.yh.correct.service.IInterviewPersonnelService;


/**
 * 
 * 走访登记业务层实现类
 * @author Administrator
 *
 */
@Service
public class InterviewPersonnelServiceImpl implements IInterviewPersonnelService {
	
	private static Logger logger = LogManager.getLogger(ExpireServiceImpl.class);
	
	@Autowired
	public IInterviewPersonnelMapper iipl;

	/**
	 *根据Id查询单个走访登记信息
	 */
	@Override
	public Map getInterviewPersonnel(InterviewPersonnel interviewpersonnel) throws Exception {
		// TODO Auto-generated method stub
		return iipl.getInterviewPersonnel(interviewpersonnel);
	}

	/**
	 * 根据ID增加走访登记信息
	 */
	@Override
	public int addInterviewPersonnel(InterviewPersonnel interviewpersonnel) throws Exception {
		// TODO Auto-generated method stub
		return iipl.addInterviewPersonnel(interviewpersonnel);
	}

	/**
	 * 删除走访登记信息
	 */
	@Override
	public int delInterviewPersonnel(int id) throws Exception {
		// TODO Auto-generated method stub
		return iipl.delInterviewPersonnel(id);
	}

	/**
	 * 更新走访登记信息
	 */
	@Override
	public int editInterviewPersonnel(InterviewPersonnel interviewpersonnel) throws Exception {
		// TODO Auto-generated method stub
		return iipl.editInterviewPersonnel(interviewpersonnel);
	}

	/**
	 * 模糊查询走访登记信息列表
	 */
	@Override
	public Page getLikeAdminCount(Map<String, Object> cont) throws Exception {
		Page page = new Page();
		page.setTotalNum(iipl.getLikeInterviewPersonnelCount(cont));
		int pageSize = Integer.parseInt(String.valueOf(cont.get("pageSize")));
		page.setPageSize(pageSize);
		int pageNum = Integer.parseInt(String.valueOf(cont.get("curPageNum")));
		page.setCurPageNum(pageNum);
		page.setTotalPage(page.getTotalNum() / pageSize + (page.getTotalNum() % pageSize == 0 ? 0 : 1));
		page.setResult(iipl.getLikeInterviewPersonnel(cont));
		logger.debug("模糊查询结果"+page.getResult());
		return page;
	}

	/**
	 * 查询所有工作人员
	 * @throws Exception 
	 */
	@Override
	public List<Object> getByIdPer(int jid) throws Exception {
		// TODO Auto-generated method stub
		return iipl.getByIdPer(jid);
	}

	/**
	 * 查询所有矫正人员
	 * @throws Exception 
	 */
	@Override
	public List<Object> getAllCorr() throws Exception {
		// TODO Auto-generated method stub
		return iipl.getAllCorr();
	}

	@Override
	public List<Map<String, Object>> getAllRuleBreak() throws Exception{
		// TODO Auto-generated method stub
		return iipl.getAllRuleBreak();
	}
	
	

}
